package com.springboot.mybatis.example.service;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.springboot.mybatis.example.dao.UserDao;
import com.springboot.mybatis.example.domain.User;

@Service
public class UserServiceImpl implements UserService {

	@Resource
    private UserDao userDao;


    public User getUserById(int userId) {
        return userDao.selectByPrimaryKey(userId);
    }

    public boolean addUser(User record){
        boolean result = false;
        try {
            userDao.insertSelective(record);
            result = true;
        } catch (Exception e) {
            e.printStackTrace();
        }

        return result;
    }

	@Override
	public User insertUser(int id) {
		// TODO Auto-generated method stub
		return userDao.insertUser(id);
	}

}